package com.whcoding.multithreading.thred;

/**
 * @program: spring-boot-learning
 * @description: 多线程创建：lambda表达式
 * @author: whcoding
 * @create: 2022-06-10 14:37
 **/
public class MyThreadCreateLambda {
	public static void main(String[] args) {
		//匿名内部类创建多线程
		new Thread() {
			@Override
			public void run() {
				System.out.println(Thread.currentThread().getName() + "创建新线程1");
			}
		}.start();

		//使用Lambda表达式，实现多线程
		new Thread(() -> {
			System.out.println(Thread.currentThread().getName() + "创建新线程2");
		}).start();


		//优化Lambda
		new Thread(() -> System.out.println(Thread.currentThread().getName() + "创建新线程3")).start();

	}
}
